
<div class="container">

    <?php
    include 'member-left.php';
    include 'member-right.php';
    $filter = isset($_REQUEST["flt"]) ? $_REQUEST["flt"] : "fr";
    ?>

    <div class="member_c">


        <div class="title_mb_bg2">
            <?php if ($member->isOwner()) { ?>
                <div id="control_dis_stream">
                    <ul >
                        <li class="sub" ><a <?php if ($filter == "fr" || is_numeric($filter))
                echo 'class="active"'; ?> onclick="" href="/thanh-vien?mid=<?php echo $_SESSION['client']['id']; ?>&action=xemalbum&flt=fr" ><span>Nhóm bạn</span><span class="arrow-bottom">&nbsp;</span></a>

                            <?php
                            $arrGroup = $member->getAllGroup();
                            if ($db->NumRows($arrGroup) > 0) {
                                echo '<ul >';
                                while ($row = $db->FetchToArray($arrGroup)) {
                                    ?>
                                <li><a href="/thanh-vien?mid=<?php echo $_GET['mid']; ?>&action=xemalbum&flt=<?php echo $row['id']; ?>"><?php echo $row['group_name']; ?></a></li>
                                <?php
                            }
                            echo '</ul>';
                        }
                        ?>                        
                        </li>
                        <li><a <?php if ($filter == "cq")
                        echo 'class="active"'; ?> href="/thanh-vien?mid=<?php echo $_GET['mid']; ?>&action=xemalbum&flt=cq"  ><span>Cùng quê</span></a></li>
                        <!--                        <li><a <?php if ($filter == "ss" || $filter == "ss")
                                echo 'class="active"'; ?> href="/thanh-vien?mid=<?php echo $_GET['mid']; ?>&action=xemalbum&flt=2" ><span>Theo đuôi</span></a></li>-->
                        <li><a <?php if ($filter == "" || $filter == "pr")
                        echo 'class="active"'; ?> href="/thanh-vien?mid=<?php echo $_GET['mid']; ?>&action=xemalbum&flt=pr" ><span>Cá nhân</span></a></li>
                        <li style="display:none" id="filter-feed-loading"><img style="margin-top:5px;" src="http://banbecdn.net/images/graphics/loading.gif"></li>
                    </ul>
                    <div class="right">
                        <?php if ($member->isOwner()) { ?><input type="button"  id="btnUpload" name="btnUpload" value="Tải ảnh lên" class="btnBlogComment left"><?php } ?>
                    </div>
                <?php } else { ?>
                    <div id="control_dis_stream">
                        <ul >
                            <li><a onclick="" href="" ><span>Ảnh cá nhân</span></a></li>
                            <li class="sub"><a onclick="" href="" ><span>Ảnh của bạn bè</span></a></li>
                            <li><a onclick="" href=""  class="active"><span>Cùng quê</span></a></li>
                            <li style="display:none" id="filter-feed-loading"><img style="margin-top:5px;" src="http://banbecdn.net/images/graphics/loading.gif"></li>
                        </ul>
                        <div class="right">
                            <?php if ($member->isOwner()) { ?><input type="button"  id="btnUpload" name="btnUpload" value="Tải ảnh lên" class="btnBlogComment left"><?php } ?>
                        </div>
                    <?php } ?>

                    <div class="clear"></div>
                </div>
                <div class="album-list">
                    <ul>

                        <?php
                        $isOwner = false;
                        if ($filter == 'fr' || is_numeric($filter)) {
                            $rsImage = $member->listFriendAlbum($filter);
                        } else if ($filter == "cq") {
                            $rsImage = $member->listCQAlbum();
                        } else {
                            $rsImage = $member->listMyAlbum();
                            $isOwner = true;
                        }
                        while ($row = $db->FetchToArray($rsImage['rs'])) {

                            echo '<li id="album_id_' . $row['id'] . '" >
                            <div class="photo-dis">
                                    <a class="photo-frame-01" href="thanh-vien?mid=' . $row['mid'] . '&aid=' . $row['id'] . '&action=anhcuatoi">
                                        <img src="' . $common->get_img_thumb($row['thumb']) . '"/>
                                    </a>';
                            if ($member->isOwner() && $isOwner == true) {
                                echo'<span onclick="Lightbox.showConfirm(\'Xác nhận xóa album\', \'<b>Xóa album, toàn bộ ảnh và bình luận liên quan.</b><br/><br/>Bạn có chắc chắn không?\', \'removeAlbum(' . intval($row['id']) . ')\');" class="removealbum" title="Xóa album này"></span>';
                            }
                            echo'</div>
                             <div class="photo-desc">
                             <a class="viewImage" href="thanh-vien?mid=' . $row['mid'] . '&aid=' . $row['id'] . '&action=anhcuatoi">' . $row['name'] . '</a>
                                 <br><b>' . $row['count_num'] . ' ảnh</b>
                                   </div>
                              </li>';
                        }
                        ?>
                    </ul>
                </div>
                <?php
                $isOwner = false;
                if ($filter == 'fr' || is_numeric($filter) || $filter == "cq") {
                    $rsImage2 = $member->listMyAlbum();
                    $isOwner = true;
                    echo '<div class="">Album của tôi</div>';
                } else {
                    $rsImage2 = $member->listFriendAlbum($filter);
                    $isOwner = false;
                    echo '<div class="title">Album của bạn bè</div>';
                }
                ?>
                
                <div class="album-list">
                    <ul>

                        <?php
                        $isOwner = false;
                        if ($filter == 'fr' || is_numeric($filter) || $filter == "cq") {
                            $rsImage2 = $member->listMyAlbum();
                            $isOwner = true;
                        } else {
                            $rsImage2 = $member->listFriendAlbum($filter);
                            $isOwner = false;
                        }
                        while ($row = $db->FetchToArray($rsImage2['rs'])) {

                            echo '<li id="album_id_' . $row['id'] . '" >
                            <div class="photo-dis">
                                    <a class="photo-frame-01" href="thanh-vien?mid=' . $row['mid'] . '&aid=' . $row['id'] . '&action=anhcuatoi">
                                        <img src="' . $common->get_img_thumb($row['thumb']) . '"/>
                                    </a>';
                            if ($member->isOwner() && $isOwner == true) {
                                echo'<span onclick="Lightbox.showConfirm(\'Xác nhận xóa album\', \'<b>Xóa album, toàn bộ ảnh và bình luận liên quan.</b><br/><br/>Bạn có chắc chắn không?\', \'removeAlbum(' . intval($row['id']) . ')\');" class="removealbum" title="Xóa album này"></span>';
                            }
                            echo'</div>
                             <div class="photo-desc">
                             <a class="viewImage" href="thanh-vien?mid=' . $row['mid'] . '&aid=' . $row['id'] . '&action=anhcuatoi">' . $row['name'] . '</a>
                                 <br><b>' . $row['count_num'] . ' ảnh</b>
                                   </div>
                              </li>';
                        }
                        ?>
                    </ul>
                </div>
            </div>

        </div>
    </div>
    <script src="/js/album.js" type="text/javascript"></script>

</div>